package org.bear.mario.Running;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.imageio.ImageIO;

// 静态值类，用于存储游戏中使用的各种图片资源
public class StaticValue {
    public static List<BufferedImage> allMarioImage = new ArrayList<BufferedImage>(); // 存储所有的马里奥图片
    public static BufferedImage startImage = null; // 开始图片
    public static BufferedImage endImage = null; // 结束图片
    public static BufferedImage bgImage = null; // 背景图片
    public static List<BufferedImage> allFlowerImage = new ArrayList<BufferedImage>(); // 存储所有的花图片
    public static List<BufferedImage> allTriangleImage = new ArrayList<BufferedImage>(); // 存储所有的三角形图片
    public static List<BufferedImage> allTurtleImage = new ArrayList<BufferedImage>(); // 存储所有的乌龟图片
    public static List<BufferedImage> allObstructionImage = new ArrayList<BufferedImage>(); // 存储所有的障碍物图片
    public static BufferedImage mariDeadImage = null; // 马里奥死亡图片
    public static String ImagePath = System.getProperty("user.dir") + "/bin/"; // 图片路径

    // 初始化方法，用于加载游戏所需的所有图片资源
    public static void init() {
        for (int i = 1; i <= 10; i++) {
            try {
                allMarioImage.add(ImageIO.read(new File(ImagePath + i + ".png")));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {
            startImage = ImageIO.read(new File(ImagePath + "start.jpg"));
            bgImage = ImageIO.read(new File(ImagePath + "firststage.jpg"));
            endImage = ImageIO.read(new File(ImagePath + "firststageend.jpg"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        for (int i = 1; i <= 5; i++) {
            try {
                if (i <= 2) {
                    allFlowerImage.add(ImageIO.read(new File(ImagePath + "flower" + i + ".png")));
                }
                if (i <= 3) {
                    allTriangleImage.add(ImageIO.read(new File(ImagePath + "triangle" + i + ".png")));
                }
                allTurtleImage.add(ImageIO.read(new File(ImagePath + "Turtle" + i + ".png")));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        for (int i = 1; i <= 12; i++) {
            try {
                allObstructionImage.add(ImageIO.read(new File(ImagePath + "ob" + i + ".png")));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try {
            mariDeadImage = ImageIO.read(new File(ImagePath + "over.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

